﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Storage;

namespace BenevolentSunData
{
    public class Fog
    {

        #region Fog Properties
        bool enabled;
        public bool Enabled
        {
            get { return enabled; }
            set
            {
                enabled = value;
                structEnabled.SetValue(enabled);
            }
        }

        float start;
        public float Start
        {
            get { return start; }
            set
            {
                start = value;
                structStart.SetValue(start);
            }
        }

        float end;
        public float End
        {
            get { return end; }
            set
            {
                end = value;
                structEnd.SetValue(end);
            }
        }

        Color color;
        public Color Color
        {
            get { return color; }
            set
            {
                color = value;
                structColor.SetValue(color.ToVector3());
            }
        }
        #endregion


        #region Effect
        Effect effect;

        EffectParameter structInstance;

        EffectParameter structEnabled, structStart, structEnd, structColor;
        #endregion


        #region Initialization
        public Fog(Effect effect)
        {
            this.effect = effect;

            structInstance = effect.Parameters["Fog"];

            structEnabled = structInstance.StructureMembers["Enabled"];
            structStart = structInstance.StructureMembers["Start"];
            structEnd = structInstance.StructureMembers["End"];
            structColor = structInstance.StructureMembers["Color"];

            Enabled = false;
            Start = 0f;
            End = 100f;
            Color = Color.White;
        }
        #endregion

    }
}
